<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>EventEmitter - Go2d</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="Go2d" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: 1.6.7</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/Class.html">Class</a></li>
                                <li><a href="../classes/Director.html">Director</a></li>
                                <li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
                                <li><a href="../classes/Ease.html">Ease</a></li>
                                <li><a href="../classes/Event.html">Event</a></li>
                                <li><a href="../classes/EventEmitter.html">EventEmitter</a></li>
                                <li><a href="../classes/go2d.html">go2d</a></li>
                                <li><a href="../classes/ImageView.html">ImageView</a></li>
                                <li><a href="../classes/Matrix.html">Matrix</a></li>
                                <li><a href="../classes/ObjectPool.html">ObjectPool</a></li>
                                <li><a href="../classes/ResizeEvent.html">ResizeEvent</a></li>
                                <li><a href="../classes/ResourceLoader.html">ResourceLoader</a></li>
                                <li><a href="../classes/ScrollEvent.html">ScrollEvent</a></li>
                                <li><a href="../classes/ScrollView.html">ScrollView</a></li>
                                <li><a href="../classes/Sprite.html">Sprite</a></li>
                                <li><a href="../classes/Stage.html">Stage</a></li>
                                <li><a href="../classes/TextField.html">TextField</a></li>
                                <li><a href="../classes/TouchEvent.html">TouchEvent</a></li>
                                <li><a href="../classes/Tween.html">Tween</a></li>
                                <li><a href="../classes/URLRequest.html">URLRequest</a></li>
                                <li><a href="../classes/Vector.html">Vector</a></li>
                            </ul>
                
                            <ul id="api-modules" class="apis modules">
                                <li><a href="../modules/go2d.html">go2d</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>EventEmitter Class</h1>
<div class="box meta">

        <div class="extends">
            Extends <a href="../classes/Class.html" class="crosslink">Class</a>
        </div>

        <div class="foundat">
            Defined in: <a href="../files/src_event_EventEmitter.js.html#l1"><code>src\event\EventEmitter.js:1</code></a>
        </div>

            Module: <a href="../modules/go2d.html">go2d</a>

</div>


<div class="box intro">
    <p>事件派发器类，负责事件的派发和侦听。</p>

</div>

    <div class="constructor">
        <h2>Constructor</h2>
        <div id="method_EventEmitter" class="method item">
            <h3 class="name"><code>EventEmitter</code></h3>
        
                <div class="args">
                    <span class="paren">(</span><ul class="args-list inline commas">
                        <li class="arg">
                                <code>type</code>
                        </li>
                        <li class="arg">
                                <code class="optional">[data]</code>
                        </li>
                    </ul><span class="paren">)</span>
                </div>
        
        
        
        
        
        
        
        
            <div class="meta">
                        <p>
                        Defined in
                <a href="../files/src_event_EventEmitter.js.html#l1"><code>src\event\EventEmitter.js:1</code></a>
                </p>
        
        
        
            </div>
        
            <div class="description">
                
            </div>
        
                <div class="params">
                    <h4>Parameters:</h4>
        
                    <ul class="params-list">
                        <li class="param">
                                <code class="param-name">type</code>
                                <span class="type">String</span>
        
        
                            <div class="param-description">
                                <p>事件类型</p>
        
                            </div>
        
                        </li>
                        <li class="param">
                                <code class="param-name optional">[data]</code>
                                <span class="type">Object</span>
                                <span class="flag optional" title="This parameter is optional.">optional</span>
        
        
                            <div class="param-description">
                                <p>事件参数</p>
        
                            </div>
        
                        </li>
                    </ul>
                </div>
        
        
        
        </div>
    </div>

<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
            <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods extends">
                            <li class="index-item method">
                                <a href="#method_dispose">dispose</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_emit">emit</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_emit">emit</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_off">off</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_on">on</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_on">on</a>

                            </li>
                    </ul>
                </div>

                <div class="index-section properties">
                    <h3>Properties</h3>

                    <ul class="index-list properties extends">
                            <li class="index-item property private">
                                <a href="#property___events">__events</a>

                            </li>
                    </ul>
                </div>


        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method_dispose" class="method item">
    <h3 class="name"><code>dispose</code></h3>

        <span class="paren">()</span>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l104"><code>src\event\EventEmitter.js:104</code></a>
        </p>



    </div>

    <div class="description">
        <p>释放事件派发器内存</p>

    </div>




</div>
<div id="method_emit" class="method item">
    <h3 class="name"><code>emit</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code class="optional">[event]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">This</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l75"><code>src\event\EventEmitter.js:75</code></a>
        </p>



    </div>

    <div class="description">
        <p>通过事件对象派发事件</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>事件名称</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[event]</code>
                        <span class="type"><a href="../classes/Event.html" class="crosslink">Event</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>事件对象</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">This</span>:
            </div>
        </div>


</div>
<div id="method_emit" class="method item">
    <h3 class="name"><code>emit</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code class="optional">[params]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">This</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l82"><code>src\event\EventEmitter.js:82</code></a>
        </p>



    </div>

    <div class="description">
        <p>通过任意事件参数派发事件</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>事件名称</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[params]</code>
                        <span class="type">...</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>事件参数</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">This</span>:
            </div>
        </div>


</div>
<div id="method_off" class="method item">
    <h3 class="name"><code>off</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code class="optional">[callback]</code>
                </li>
                <li class="arg">
                        <code class="optional">[thisArg]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">This</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l52"><code>src\event\EventEmitter.js:52</code></a>
        </p>



    </div>

    <div class="description">
        <p>移除事件侦听器</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>事件名称</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[callback]</code>
                        <span class="type">Function</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>回调函数，当该参数为空时将移除该事件的所有回调</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[thisArg]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>回调执行时 this 关键字所引用的对象</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">This</span>:
            </div>
        </div>


</div>
<div id="method_on" class="method item">
    <h3 class="name"><code>on</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code>callback</code>
                </li>
                <li class="arg">
                        <code class="optional">[thisArg]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">This</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l21"><code>src\event\EventEmitter.js:21</code></a>
        </p>



    </div>

    <div class="description">
        <p>添加事件侦听器</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>事件名称</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">callback</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>回调函数</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[thisArg]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>回调执行时 this 关键字所引用的对象</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">This</span>:
            </div>
        </div>


</div>
<div id="method_on" class="method item">
    <h3 class="name"><code>on</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>listeners</code>
                </li>
                <li class="arg">
                        <code class="optional">[thisArg]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">This</span>
        </span>







    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_event_EventEmitter.js.html#l29"><code>src\event\EventEmitter.js:29</code></a>
        </p>



    </div>

    <div class="description">
        <p>批量添加事件侦听器</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">listeners</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>以事件名称为键名，回调函数为键值的哈希表</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[thisArg]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>回调执行时 this 关键字所引用的对象</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">This</span>:
            </div>
        </div>


</div>
            </div>

            <div id="properties" class="api-class-tabpanel">
                <h2 class="off-left">Properties</h2>

                    <div id="property___events" class="property item private">
                        <h3 class="name"><code>__events</code></h3>
                        <span class="type">Object</span>
                    
                    
                            <span class="flag private">private</span>
                    
                    
                    
                        <div class="meta">
                                    <p>
                                    Defined in
                            <a href="../files/src_event_EventEmitter.js.html#l13"><code>src\event\EventEmitter.js:13</code></a>
                            </p>
                    
                    
                        </div>
                    
                        <div class="description">
                            <p>侦听器哈希表</p>
                    
                        </div>
                    
                    
                    
                    </div>
            </div>


    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
